<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<p>MysqlnewsDao.selectAll() 를 통해 db 에 저장된 데이터를
 list형태로 다 받을 수 있습니다 . </p> 
<p>데이터 받어서 화면에 table로 출력하세요</p>
<%@ page import="dao.MysqlNewsDao" 
	import="model.News" import="java.util.*" %> 
<%
MysqlNewsDao dao=new MysqlNewsDao();
ArrayList<News> list=dao.selectAll();
request.setAttribute("list", list); 
%>
<%@ taglib prefix="c" 
	uri="http://java.sun.com/jsp/jstl/core" %>
<table border="1">
	<tr>
		<td>번호</td>
		<td>제목</td>
		<td>내용</td>
		<td>작성일</td>
		<td>이미지</td>
	</tr>	  
	<c:forEach var="news" items="${list}"> 
	<tr>  
		<td>${news.num}</td>
		<td>${news.title}</td>
		<td>${news.content}</td>
		<td>${news.day}</td>
		<td><img src="${news.img}" width="100"></td>  
	</tr>   
	</c:forEach>  
</table>
  
  
  
  
</body>
</html>